package com.hema.auction.widget.view;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.hema.auction.R;
import com.hema.auction.bean.GoodsInfo;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * author by john
 */

public class MyAuctionView extends LinearLayout {

    @BindView(R.id.tv_date)
    TextView tvDate;
    @BindView(R.id.tv_status)
    TextView tvStatus;
    @BindView(R.id.iv_img)
    ImageView ivImg;
    @BindView(R.id.tv_market_price)
    TextView tvMarketPrice;
    @BindView(R.id.tv_shopping_coin)
    TextView tvShoppingCoin;
    @BindView(R.id.tv_my_bid)
    TextView tvMyBid;
    @BindView(R.id.tv_auction)
    TextView tvAuction;

    public MyAuctionView(Context context) {
        super(context);
        init();
    }

    public MyAuctionView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public MyAuctionView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    private void init() {
        ButterKnife.bind(this, LayoutInflater.from(getContext()).inflate(R.layout.layout_my_auciton_view, this));
    }

    public void setData(GoodsInfo info) {
        Glide.with(getContext()).load(info.getImg()).into(ivImg);
        tvDate.setText(info.getDate());
        tvMarketPrice.setText(info.getPrice());
        tvShoppingCoin.setText(info.getUseShoppingCoin());
        tvMyBid.setText(info.getDid()+"次");
    }


}
